ÅüGetTateShift( ) function
/*------------------------------------------------------------------------------ Copyright © 1992, Apple Computer, Inc, All Rights Reserved. File: GetTateShift.c Author: Masaya Ishii Revisions: (most recent first): ID Date Description <1> 19/06/92 Masaya Ishii - Created file. ------------------------------------------------------------------------------*/ #include <Fonts.h> typedef char int8; typedef unsigned char uint8; typedef short int16; typedef unsigned short uint16; typedef long int32; typedef unsigned long uint32; typedef short FWord; typedef unsigned short uFWord; typedef long F26Dot6; typedef long sfnt_TableTag; typedef struct { sfnt_TableTag tag; uint32 checkSum; uint32 offset; uint32 length; } sfnt_DirectoryEntry; typedef struct { int32 version; /* 0x10000 (1.0) */ uint16 numOffsets; /* number of tables */ uint16 searchRange; /* (max2 <= numOffsets)*16 */ uint16 entrySelector; /* log2(max2 <= numOffsets) */ uint16 rangeShift; /* numOffsets*16-searchRange*/ sfnt_DirectoryEntry table[1]; /* table[numOffsets] */ } sfnt_OffsetTable; /*------------------------------------------------------------------------------ Function : Get shift value for 'tategaki' characters. Parameters : Handle to FOND resource. Return value : >0 : Shift value of 'tategaki'. -1 : This font is NOT have 'tategaki' table. (6.x compatible fonts.) ------------------------------------------------------------------------------*/ long GetTateShift(Handle FOND) { long ffIntl = *(long *)&(((FamRec *)*FOND)->ffIntl); sfnt_OffsetTable *OffsetTable; uint16 i; if(!ffIntl) return -1; // 6.x compatible. OffsetTable = (sfnt_OffsetTable *)(ffIntl + *FOND); for(i=0; i< OffsetTable->numOffsets; i++) if (OffsetTable->table[i].tagÅ@== 'tate') return *(long*)(OffsetTable->table[i].offset + (long)OffsetTable); return -1; // table not found. }